#!/bin/bash
echo 'build start, version: '$1
echo 'creating cc_monitor.wdgt'
rm -rf cc_monitor.wdgt
mkdir cc_monitor.wdgt
mkdir cc_monitor.wdgt/images
mkdir cc_monitor.wdgt/core
mkdir cc_monitor.wdgt/growl
mkdir cc_monitor.wdgt/lib

cp Contents/*.* cc_monitor.wdgt
cp Contents/images/*.* cc_monitor.wdgt/images
cp Contents/core/*.* cc_monitor.wdgt/core
cp Contents/growl/*.* cc_monitor.wdgt/growl
cp Contents/lib/*.* cc_monitor.wdgt/lib

echo 'zipping...'
rm -f *.zip
zip -r cc_monitor-$1.zip cc_monitor.wdgt

echo 'creating update version json file'
echo '{
  number: '$2',
  description: "",
  updateLink: "http://ccmonitor.googlecode.com/files/cc_monitor-'$1'.zip"
}' >> cc-monitor-$2-update.json
echo 'done.'
